package cn.com.redis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping
public class IndexController {
    @Autowired
    RedisTemplate redisTemplate;
    @ResponseBody
    @RequestMapping("/show")
    public String show(String str){
        return str;
    }
    @RequestMapping("/index")
    public String index(String str){
        System.out.println(redisTemplate);
        redisTemplate.getConnectionFactory().getConnection().setNX(redisTemplate.getStringSerializer().serialize("keyspring-1"),redisTemplate.getStringSerializer().serialize("12321323"));
        return "index";
    }
}
